package com.j.lemon.learn.basic.object.justtest;




import java.io.Serializable;
import java.lang.reflect.Field;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.Objects;

/**
 * @Author lijunjun
 * @Date 2019-02-20 10:13
 * @Description
 */
public class Employee extends Person implements Comparable<Employee>,Human, Serializable {
    private static final long serialVersionUID = 7320509985157295551L;
    private Integer age;

    public String name ;

    public Employee(Integer age,String name) {
        this.age= age;
        this.name = name;
    }

    @Override
    public void eat() {
        System.out.println("employee eat");
    }

    @Override
    public void sing() {
        System.out.println("employee sing");
    }

    @Override
    public void work(String name,String age){

    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static void main(String[] args) throws IllegalAccessException, ClassNotFoundException {

        Class<?> aClass = Class.forName("com.oracle.nio.BufferSecrets");

//        aClass= BufferSecrets.class;
        ClassLoader classLoader1 = aClass.getClassLoader();

        Field[] declaredFields = aClass.getDeclaredFields();
        Arrays.asList(declaredFields).forEach(field -> System.out.println(field.getName()));

        List<String> list = new LinkedList<>();
        list.add("1");
        list.add("2");
        list.add("3");

        list.forEach(System.out::println);

//        Employee e1 = new Employee("2");
//        Employee o = e1;
//        o.setName("aaa");
//        System.out.println(e1.getName());
//
//        Person pp = new Employee("lala");
//        System.out.println(pp.description);
//        String.valueOf(123);
//        Integer.toString(123);
//
//        String [] arr = new String[]{"1","2"};
//        List<String> list = Arrays.asList(arr);
//        list.add("3");
//        System.out.println(arr.length);
//        System.out.println(list.size());



    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Employee employee = (Employee) o;
        return Objects.equals(name, employee.name);
    }

    @Override
    public int hashCode() {
        return Objects.hash(name);
    }

    @Override
    public int compareTo(Employee o) {
        return Integer.compare(Integer.parseInt(name), Integer.parseInt(o.name));
    }

    @Override
    public void dance() {
        System.out.println("emp dance");
    }

    @Override
    public String toString() {
        return "Employee{" +
                "age=" + age +
                ", name='" + name + '\'' +
                '}';
    }
}
